package com.openbravo.pos.reports;

import com.openbravo.basic.BasicException;
import com.openbravo.data.loader.SerializerWrite;
import com.openbravo.data.loader.SerializerWriteComposed;
import com.openbravo.pos.forms.AppView;
import java.awt.Component;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.JPanel;

public class JParamsComposed extends JPanel
  implements ReportEditorCreator
{
  private List<ReportEditorCreator> editors = new ArrayList();

  public JParamsComposed()
  {
    initComponents();
  }

  public void init(AppView paramAppView)
  {
    Iterator localIterator = this.editors.iterator();
    while (localIterator.hasNext())
    {
      ReportEditorCreator localReportEditorCreator = (ReportEditorCreator)localIterator.next();
      localReportEditorCreator.init(paramAppView);
    }
  }

  public void activate()
    throws BasicException
  {
    Iterator localIterator = this.editors.iterator();
    while (localIterator.hasNext())
    {
      ReportEditorCreator localReportEditorCreator = (ReportEditorCreator)localIterator.next();
      localReportEditorCreator.activate();
    }
  }

  public SerializerWrite getSerializerWrite()
  {
    SerializerWriteComposed localSerializerWriteComposed = new SerializerWriteComposed();
    Iterator localIterator = this.editors.iterator();
    while (localIterator.hasNext())
    {
      ReportEditorCreator localReportEditorCreator = (ReportEditorCreator)localIterator.next();
      localSerializerWriteComposed.add(localReportEditorCreator.getSerializerWrite());
    }
    return localSerializerWriteComposed;
  }

  public Component getComponent()
  {
    return this;
  }

  public Object createValue()
    throws BasicException
  {
    Object[] arrayOfObject = new Object[this.editors.size()];
    for (int i = 0; i < this.editors.size(); i++)
      arrayOfObject[i] = ((ReportEditorCreator)this.editors.get(i)).createValue();
    return arrayOfObject;
  }

  public void addEditor(ReportEditorCreator paramReportEditorCreator)
  {
    this.editors.add(paramReportEditorCreator);
    add(paramReportEditorCreator.getComponent());
  }

  public boolean isEmpty()
  {
    return this.editors.isEmpty();
  }

  private void initComponents()
  {
    setLayout(new BoxLayout(this, 1));
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.reports.JParamsComposed
 * JD-Core Version:    0.6.0
 */